home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / popen.man < prev    next >
Encoding:
Text File  |  1990-03-01  |  2.0 KB  |  67 lines

  1.  
  2.  
  3.  
  4. POPEN                 C Library Procedures                  POPEN
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      popen, pclose - initiate I/O to/from a process
  10.  
  11. SSYYNNOOPPSSIISS
  12.      ##iinncclluuddee <<ssttddiioo..hh>>
  13.  
  14.      FFIILLEE **ppooppeenn((ccoommmmaanndd,, ttyyppee))
  15.      cchhaarr **ccoommmmaanndd,, **ttyyppee;;
  16.  
  17.      ppcclloossee((ssttrreeaamm))
  18.      FFIILLEE **ssttrreeaamm;;
  19.  
  20. DDEESSCCRRIIPPTTIIOONN
  21.      The arguments to _p_o_p_e_n are pointers to null-terminated
  22.      strings containing respectively a shell command line and an
  23.      I/O mode, either "r" for reading or "w" for writing.  It
  24.      creates a pipe between the calling process and the command
  25.      to be executed.  The value returned is a stream pointer that
  26.      can be used (as appropriate) to write to the standard input
  27.      of the command or read from its standard output.
  28.  
  29.      A stream opened by _p_o_p_e_n should be closed by _p_c_l_o_s_e, which
  30.      waits for the associated process to terminate and returns
  31.      the exit status of the command.
  32.  
  33.      Because open files are shared, a type "r" command may be
  34.      used as an input filter, and a type "w" as an output filter.
  35.  
  36. SSEEEE AALLSSOO
  37.      pipe(2), fopen(3S), fclose(3S), system(3), wait(2), sh(1)
  38.  
  39. DDIIAAGGNNOOSSTTIICCSS
  40.      _P_o_p_e_n returns a null pointer if files or processes cannot be
  41.      created, or the shell cannot be accessed.
  42.  
  43.      _P_c_l_o_s_e returns -1 if _s_t_r_e_a_m is not associated with a
  44.      `popened' command.
  45.  
  46. BBUUGGSS
  47.      Buffered reading before opening an input filter may leave
  48.      the standard input of that filter mispositioned.  Similar
  49.      problems with an output filter may be forestalled by careful
  50.      buffer flushing, for instance, with _f_f_l_u_s_h, see _f_c_l_o_s_e(3S).
  51.  
  52.      _P_o_p_e_n always calls _s_h, never calls _c_s_h.
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63. Sprite v1.0               May 15, 1985                          1
  64.  
  65.  
  66.  
  67.